#delimit;
clear all;
set more off;

capture log using "09_DAF_Grantee_Summary_Table.log", replace;
/*******************************************************************************************/;
** INPUT: This uses the DAF grantee data from Guidestar that is combined with grantee financial;
**        and governance info from NBER/AWS as well as inequality data from Chetty et al.;
** OUTPUT: Regression tables relating DAF characteristics to where grants get allocated;
** LAST MODIFIED: JAG, 9/4/2021;
** RUN TIME: 10 minutes using Stata 15 on computer with 2 x 2.60GHz processors and 64GB RAM;
/*******************************************************************************************/;

** The goal is to summarize characteristics of the grantees based on the type of DAF;
** So we know if the grantee is highly illiquid or if it is in an area of high inequality, etc...;

***************************************************;
** THIS IS WHERE START FORMATTING FOR THE VARIOUS COLUMNS IN THE TABLE;
** THESE ARE THE VARIABLES OF INTEREST AND THE NAMES;
** # Grants = dga_count;
** Grant Amount = dga;
** Avg. grant amount = dga_avg;
** Avg. age of grantee = lag_gr_age;
**% to orgs in high inequality areas = high_lag_ineq  ;
**% to orgs with DE\&I focus = super hard to classify unless have population served;
**% to orgs that are profitable = lag_gr_prof_ind ;
**% to orgs with high unrestricted surplus = high_lag_gr_prof_alt;
**% to orgs with high LUNA = high_lag_gr_mths_luna ;
**% to orgs with high liquidity constraints = high_lag_gr_mths_liquid ;
**% to orgs with high cash volatility = high_lag_gr_volat;
**% to orgs that are gift dependent = high_lag_gr_gift_dep;
**% to orgs that fundraise = high_lag_gr_ind_f;
**% to orgs with high fundr. efficiency = high_lag_gr_f2contr;
**% to orgs with high fundr. margins = high_lag_gr_mgn_fevents;
**% to orgs with high admin. efficiency  = high_lag_gr_adm_eff;
**% to orgs with weak governance = high_lag_bgov_tot;
**% to orgs with high transparency = high_lag_gr_uses_auditor;
**% to orgs with high exec. comp = high_lag_bgov5;

** Looping through the various types;
*******************************************************
** TRADITIONAL DAFS ALL;
use "all grantee stats by daf.dta", clear;
gen count=1;
bys ein: gen uniq_count=1 if _n==1;
collapse (sum) uniq_count count dga_count dga (mean) sd_dga dga_count_avg dga_avg lag_gr_age 
high_ineq high_ineq2 lag_gr_prof_ind high_lag_gr_prof_alt 
high_lag_gr_mths_luna high_lag_gr_mths_liquid high_lag_gr_volat  
high_lag_gr_gift_dep high_lag_gr_ind_f high_lag_gr_f2contr 
high_lag_gr_mgn_fevent high_lag_gr_adm_eff high_lag_gr_mgmt_eff 
high_lag_bgov_max high_lag_bgov_tot high_lag_bgov14 high_lag_bgov56
high_lag_gr_uses_auditor high_lag_bgov5 lag_gr_highest_ecomp
high_lag_gr_highest_ecomp high_lag_gr_100k_comp high_lag_gr_100k_contr
high_lag_gr_pct_fevents lag_gr_comm_np high_lag_gr_f2exp high_lag_gr_mjr90_frev high_lag_gr_mjr75_frev 
high_lag_contrib_rev p90_lag_contrib_rev p75_lag_contrib_rev p25_lag_contrib_rev;
** Formatting things to be easier to put into latex;
format dga %12.0fc;
format count %12.0fc;
format dga_avg %12.0fc;
format lag_gr_age %3.0fc;
rename lag_gr_highest_ecomp act_gr_highest_ecomp;
foreach x in high_ineq high_ineq2 lag_gr_prof_ind high_lag_gr_prof_alt 
high_lag_gr_mths_luna high_lag_gr_mths_liquid high_lag_gr_volat  
high_lag_gr_gift_dep high_lag_gr_ind_f high_lag_gr_f2contr 
high_lag_gr_mgn_fevent high_lag_gr_adm_eff high_lag_gr_mgmt_eff 
high_lag_bgov_max high_lag_bgov_tot high_lag_bgov14 high_lag_bgov56
high_lag_gr_uses_auditor high_lag_bgov5 
high_lag_gr_highest_ecomp high_lag_gr_100k_comp high_lag_gr_100k_contr
high_lag_gr_pct_fevents lag_gr_comm_np high_lag_gr_f2exp high_lag_gr_mjr90_frev high_lag_gr_mjr75_frev
high_lag_contrib_rev p90_lag_contrib_rev p75_lag_contrib_rev p25_lag_contrib_rev{;
	replace `x'=`x'*100;
	format `x' %9.1fc;
};
gen type="all";
** Renaming those named "high" meaning they are above median to original var so can merge value-weighted later;
foreach x in ineq ineq2 lag_gr_prof_alt 
lag_gr_mths_luna lag_gr_mths_liquid lag_gr_volat  
lag_gr_gift_dep lag_gr_ind_f lag_gr_f2contr 
lag_gr_mgn_fevent lag_gr_adm_eff lag_gr_mgmt_eff 
lag_bgov_max lag_bgov_tot lag_bgov14 lag_bgov56
lag_gr_uses_auditor lag_bgov5 
lag_gr_highest_ecomp lag_gr_100k_comp lag_gr_100k_contr
lag_gr_pct_fevents lag_gr_f2exp 
lag_gr_mjr90_frev lag_gr_mjr75_frev lag_contrib_rev {;
	rename high_`x' `x';
};
save "avg grantee all.dta", replace;

use "all grantee stats by daf.dta", clear;
gen count=1;
bys ein: gen uniq_count=1 if _n==1;
collapse (sum) uniq_count count dga_count dga (mean) sd_dga dga_count_avg dga_avg lag_gr_age 
vw_dga_ineq vw_dga_ineq2 vw_dga_lag_gr_prof_alt 
vw_dga_lag_gr_mths_luna vw_dga_lag_gr_mths_liquid vw_dga_lag_gr_volat  
vw_dga_lag_gr_gift_dep vw_dga_lag_gr_ind_f vw_dga_lag_gr_f2contr 
vw_dga_lag_gr_mgn_fevent vw_dga_lag_gr_adm_eff vw_dga_lag_gr_mgmt_eff 
vw_dga_lag_bgov_max vw_dga_lag_bgov_tot vw_dga_lag_bgov14 vw_dga_lag_bgov56
vw_dga_lag_gr_uses_auditor vw_dga_lag_bgov5 
vw_dga_lag_gr_highest_ecomp vw_dga_lag_gr_100k_comp vw_dga_lag_gr_100k_contr
vw_dga_lag_gr_pct_fevents vw_dga_lag_gr_f2exp vw_dga_lag_gr_mjr90_frev vw_dga_lag_gr_mjr75_frev
vw_dga_lag_contrib_rev vw_dga_p90_lag_contrib_rev vw_dga_p75_lag_contrib_rev vw_dga_p25_lag_contrib_rev
vw_dga_lag_gr_comm_np vw_dga_lag_gr_prof_ind;
** Formatting things to be easier to put into latex;
format dga %12.0fc;
format count %12.0fc;
format dga_avg %12.0fc;
format lag_gr_age %3.0fc;
foreach x in ineq ineq2 lag_gr_prof_alt 
lag_gr_mths_luna lag_gr_mths_liquid lag_gr_volat  
lag_gr_gift_dep lag_gr_ind_f lag_gr_f2contr 
lag_gr_mgn_fevent lag_gr_adm_eff lag_gr_mgmt_eff 
lag_bgov_max lag_bgov_tot lag_bgov14 lag_bgov56
lag_gr_uses_auditor lag_bgov5 
lag_gr_highest_ecomp lag_gr_100k_comp lag_gr_100k_contr
lag_gr_pct_fevents lag_gr_f2exp lag_gr_mjr90_frev lag_gr_mjr75_frev
lag_contrib_rev p90_lag_contrib_rev p75_lag_contrib_rev p25_lag_contrib_rev
lag_gr_comm_np lag_gr_prof_ind{;
	replace vw_dga_`x'=vw_dga_`x'*100;
	format vw_dga_`x' %2.1fc;
	** Adding the rename in this loop as all are renamed unlike with non-vw;
	rename vw_dga_`x' `x';
};
gen type="all value-weighted";
save "avg grantee all value-weighted.dta", replace;

** Looping through the various types;
*******************************************************
** STYLE = TRADITIONAL;
use "all grantee stats by daf.dta", clear;
gen count=1;
keep if style_trad==1;
save "trad stand alone grant.dta", replace;
bys ein: gen uniq_count=1 if _n==1;
collapse (sum) uniq_count count dga_count dga (mean) sd_dga dga_count_avg dga_avg lag_gr_age 
high_ineq high_ineq2 lag_gr_prof_ind high_lag_gr_prof_alt 
high_lag_gr_mths_luna high_lag_gr_mths_liquid high_lag_gr_volat  
high_lag_gr_gift_dep high_lag_gr_ind_f high_lag_gr_f2contr 
high_lag_gr_mgn_fevent high_lag_gr_adm_eff high_lag_gr_mgmt_eff 
high_lag_bgov_max high_lag_bgov_tot high_lag_bgov14 high_lag_bgov56
high_lag_gr_uses_auditor high_lag_bgov5 lag_gr_highest_ecomp
high_lag_gr_highest_ecomp high_lag_gr_100k_comp high_lag_gr_100k_contr
high_lag_gr_pct_fevents lag_gr_comm_np high_lag_gr_f2exp high_lag_gr_mjr90_frev high_lag_gr_mjr75_frev 
high_lag_contrib_rev p90_lag_contrib_rev p75_lag_contrib_rev p25_lag_contrib_rev;
** Formatting things to be easier to put into latex;
format dga %12.0fc;
format count %12.0fc;
format dga_avg %12.0fc;
format lag_gr_age %3.0fc;
rename lag_gr_highest_ecomp act_gr_highest_ecomp;
foreach x in high_ineq high_ineq2 lag_gr_prof_ind high_lag_gr_prof_alt 
high_lag_gr_mths_luna high_lag_gr_mths_liquid high_lag_gr_volat  
high_lag_gr_gift_dep high_lag_gr_ind_f high_lag_gr_f2contr 
high_lag_gr_mgn_fevent high_lag_gr_adm_eff high_lag_gr_mgmt_eff 
high_lag_bgov_max high_lag_bgov_tot high_lag_bgov14 high_lag_bgov56
high_lag_gr_uses_auditor high_lag_bgov5 
high_lag_gr_highest_ecomp high_lag_gr_100k_comp high_lag_gr_100k_contr
high_lag_gr_pct_fevents lag_gr_comm_np high_lag_gr_f2exp high_lag_gr_mjr90_frev high_lag_gr_mjr75_frev
high_lag_contrib_rev p90_lag_contrib_rev p75_lag_contrib_rev p25_lag_contrib_rev{;
	replace `x'=`x'*100;
	format `x' %9.1fc;
};
gen type="trad stand alone";
** Renaming those named "high" meaning they are above median to original var so can merge value-weighted later;
foreach x in ineq ineq2 lag_gr_prof_alt 
lag_gr_mths_luna lag_gr_mths_liquid lag_gr_volat  
lag_gr_gift_dep lag_gr_ind_f lag_gr_f2contr 
lag_gr_mgn_fevent lag_gr_adm_eff lag_gr_mgmt_eff 
lag_bgov_max lag_bgov_tot lag_bgov14 lag_bgov56
lag_gr_uses_auditor lag_bgov5 
lag_gr_highest_ecomp lag_gr_100k_comp lag_gr_100k_contr
lag_gr_pct_fevents lag_gr_f2exp 
lag_gr_mjr90_frev lag_gr_mjr75_frev lag_contrib_rev {;
	rename high_`x' `x';
};
save "avg grantee trad stand alone.dta", replace;

use "all grantee stats by daf.dta", clear;
gen count=1;
keep if style_trad==1;
save "trad stand alone grant vw.dta", replace;
bys ein: gen uniq_count=1 if _n==1;
collapse (sum) uniq_count count dga_count dga (mean) sd_dga dga_count_avg dga_avg lag_gr_age 
vw_dga_ineq vw_dga_ineq2 vw_dga_lag_gr_prof_alt 
vw_dga_lag_gr_mths_luna vw_dga_lag_gr_mths_liquid vw_dga_lag_gr_volat  
vw_dga_lag_gr_gift_dep vw_dga_lag_gr_ind_f vw_dga_lag_gr_f2contr 
vw_dga_lag_gr_mgn_fevent vw_dga_lag_gr_adm_eff vw_dga_lag_gr_mgmt_eff 
vw_dga_lag_bgov_max vw_dga_lag_bgov_tot vw_dga_lag_bgov14 vw_dga_lag_bgov56
vw_dga_lag_gr_uses_auditor vw_dga_lag_bgov5 
vw_dga_lag_gr_highest_ecomp vw_dga_lag_gr_100k_comp vw_dga_lag_gr_100k_contr
vw_dga_lag_gr_pct_fevents vw_dga_lag_gr_f2exp vw_dga_lag_gr_mjr90_frev vw_dga_lag_gr_mjr75_frev
vw_dga_lag_contrib_rev vw_dga_p90_lag_contrib_rev vw_dga_p75_lag_contrib_rev vw_dga_p25_lag_contrib_rev
vw_dga_lag_gr_comm_np vw_dga_lag_gr_prof_ind;
** Formatting things to be easier to put into latex;
format dga %12.0fc;
format count %12.0fc;
format dga_avg %12.0fc;
format lag_gr_age %3.0fc;
foreach x in ineq ineq2 lag_gr_prof_alt 
lag_gr_mths_luna lag_gr_mths_liquid lag_gr_volat  
lag_gr_gift_dep lag_gr_ind_f lag_gr_f2contr 
lag_gr_mgn_fevent lag_gr_adm_eff lag_gr_mgmt_eff 
lag_bgov_max lag_bgov_tot lag_bgov14 lag_bgov56
lag_gr_uses_auditor lag_bgov5 
lag_gr_highest_ecomp lag_gr_100k_comp lag_gr_100k_contr
lag_gr_pct_fevents lag_gr_f2exp lag_gr_mjr90_frev lag_gr_mjr75_frev
lag_contrib_rev p90_lag_contrib_rev p75_lag_contrib_rev p25_lag_contrib_rev
lag_gr_comm_np lag_gr_prof_ind{;
	replace vw_dga_`x'=vw_dga_`x'*100;
	format vw_dga_`x' %2.1fc;
	** Adding the rename in this loop as all are renamed unlike with non-vw;
	rename vw_dga_`x' `x';
};
gen type="trad stand alone value-weighted";
save "avg grantee trad stand alone value-weighted.dta", replace;

*******************************************************
** INNOVATIVE DAFS;
use "all grantee stats by daf.dta", clear;
gen count=1;
keep if style_innov==1;
save "innov stand alone grant.dta", replace;
bys ein: gen uniq_count=1 if _n==1;
collapse (sum) uniq_count count dga_count dga (mean) sd_dga dga_count_avg dga_avg lag_gr_age 
high_ineq high_ineq2 lag_gr_prof_ind high_lag_gr_prof_alt 
high_lag_gr_mths_luna high_lag_gr_mths_liquid high_lag_gr_volat  
high_lag_gr_gift_dep high_lag_gr_ind_f high_lag_gr_f2contr 
high_lag_gr_mgn_fevent high_lag_gr_adm_eff high_lag_gr_mgmt_eff 
high_lag_bgov_max high_lag_bgov_tot high_lag_bgov14 high_lag_bgov56
high_lag_gr_uses_auditor high_lag_bgov5 lag_gr_highest_ecomp
high_lag_gr_highest_ecomp high_lag_gr_100k_comp high_lag_gr_100k_contr
high_lag_gr_pct_fevents lag_gr_comm_np high_lag_gr_f2exp high_lag_gr_mjr90_frev high_lag_gr_mjr75_frev 
high_lag_contrib_rev p90_lag_contrib_rev p75_lag_contrib_rev p25_lag_contrib_rev;
** Formatting things to be easier to put into latex;
format dga %12.0fc;
format count %12.0fc;
format dga_avg %12.0fc;
format lag_gr_age %3.0fc;
rename lag_gr_highest_ecomp act_gr_highest_ecomp;
foreach x in high_ineq high_ineq2 lag_gr_prof_ind high_lag_gr_prof_alt 
high_lag_gr_mths_luna high_lag_gr_mths_liquid high_lag_gr_volat  
high_lag_gr_gift_dep high_lag_gr_ind_f high_lag_gr_f2contr 
high_lag_gr_mgn_fevent high_lag_gr_adm_eff high_lag_gr_mgmt_eff 
high_lag_bgov_max high_lag_bgov_tot high_lag_bgov14 high_lag_bgov56
high_lag_gr_uses_auditor high_lag_bgov5 
high_lag_gr_highest_ecomp high_lag_gr_100k_comp high_lag_gr_100k_contr
high_lag_gr_pct_fevents lag_gr_comm_np high_lag_gr_f2exp high_lag_gr_mjr90_frev high_lag_gr_mjr75_frev
high_lag_contrib_rev p90_lag_contrib_rev p75_lag_contrib_rev p25_lag_contrib_rev{;
	replace `x'=`x'*100;
	format `x' %9.1fc;
};
gen type="innov stand alone";
** Renaming those named "high" meaning they are above median to original var so can merge value-weighted later;
foreach x in ineq ineq2 lag_gr_prof_alt 
lag_gr_mths_luna lag_gr_mths_liquid lag_gr_volat  
lag_gr_gift_dep lag_gr_ind_f lag_gr_f2contr 
lag_gr_mgn_fevent lag_gr_adm_eff lag_gr_mgmt_eff 
lag_bgov_max lag_bgov_tot lag_bgov14 lag_bgov56
lag_gr_uses_auditor lag_bgov5 
lag_gr_highest_ecomp lag_gr_100k_comp lag_gr_100k_contr
lag_gr_pct_fevents lag_gr_f2exp 
lag_gr_mjr90_frev lag_gr_mjr75_frev lag_contrib_rev {;
	rename high_`x' `x';
};
save "avg grantee innov stand alone.dta", replace;
** Switching to value-weighted;
use "all grantee stats by daf.dta", clear;
gen count=1;
keep if style_innov==1;
save "innov stand alone grant vw.dta", replace;
bys ein: gen uniq_count=1 if _n==1;
collapse (sum) uniq_count count dga_count dga (mean) sd_dga dga_count_avg dga_avg lag_gr_age 
vw_dga_ineq vw_dga_ineq2 vw_dga_lag_gr_prof_alt 
vw_dga_lag_gr_mths_luna vw_dga_lag_gr_mths_liquid vw_dga_lag_gr_volat  
vw_dga_lag_gr_gift_dep vw_dga_lag_gr_ind_f vw_dga_lag_gr_f2contr 
vw_dga_lag_gr_mgn_fevent vw_dga_lag_gr_adm_eff vw_dga_lag_gr_mgmt_eff 
vw_dga_lag_bgov_max vw_dga_lag_bgov_tot vw_dga_lag_bgov14 vw_dga_lag_bgov56
vw_dga_lag_gr_uses_auditor vw_dga_lag_bgov5 
vw_dga_lag_gr_highest_ecomp vw_dga_lag_gr_100k_comp vw_dga_lag_gr_100k_contr
vw_dga_lag_gr_pct_fevents vw_dga_lag_gr_f2exp vw_dga_lag_gr_mjr90_frev vw_dga_lag_gr_mjr75_frev
vw_dga_lag_contrib_rev vw_dga_p90_lag_contrib_rev vw_dga_p75_lag_contrib_rev vw_dga_p25_lag_contrib_rev
vw_dga_lag_gr_comm_np vw_dga_lag_gr_prof_ind;
** Formatting things to be easier to put into latex;
format dga %12.0fc;
format count %12.0fc;
format dga_avg %12.0fc;
format lag_gr_age %3.0fc;
foreach x in ineq ineq2 lag_gr_prof_alt 
lag_gr_mths_luna lag_gr_mths_liquid lag_gr_volat  
lag_gr_gift_dep lag_gr_ind_f lag_gr_f2contr 
lag_gr_mgn_fevent lag_gr_adm_eff lag_gr_mgmt_eff 
lag_bgov_max lag_bgov_tot lag_bgov14 lag_bgov56
lag_gr_uses_auditor lag_bgov5 
lag_gr_highest_ecomp lag_gr_100k_comp lag_gr_100k_contr
lag_gr_pct_fevents lag_gr_f2exp lag_gr_mjr90_frev lag_gr_mjr75_frev
lag_contrib_rev p90_lag_contrib_rev p75_lag_contrib_rev p25_lag_contrib_rev
lag_gr_comm_np lag_gr_prof_ind{;
	replace vw_dga_`x'=vw_dga_`x'*100;
	format vw_dga_`x' %2.1fc;
	** Adding the rename in this loop as all are renamed unlike with non-vw;
	rename vw_dga_`x' `x';
};
gen type="innov stand alone value-weighted";
save "avg grantee innov stand alone value-weighted.dta", replace;


*******************************************************
** DISRUPTIVE STYLE;
use "all grantee stats by daf.dta", clear;
gen count=1;
bys ein: gen uniq_count=1 if _n==1;
keep if style_disrupt==1;
save "disrupt stand alone grant.dta", replace;
collapse (sum) uniq_count count dga_count dga (mean) sd_dga dga_count_avg dga_avg lag_gr_age 
high_ineq high_ineq2 lag_gr_prof_ind high_lag_gr_prof_alt 
high_lag_gr_mths_luna high_lag_gr_mths_liquid high_lag_gr_volat  
high_lag_gr_gift_dep high_lag_gr_ind_f high_lag_gr_f2contr 
high_lag_gr_mgn_fevent high_lag_gr_adm_eff high_lag_gr_mgmt_eff 
high_lag_bgov_max high_lag_bgov_tot high_lag_bgov14 high_lag_bgov56
high_lag_gr_uses_auditor high_lag_bgov5 lag_gr_highest_ecomp
high_lag_gr_highest_ecomp high_lag_gr_100k_comp high_lag_gr_100k_contr
high_lag_gr_pct_fevents lag_gr_comm_np high_lag_gr_f2exp high_lag_gr_mjr90_frev high_lag_gr_mjr75_frev 
high_lag_contrib_rev p90_lag_contrib_rev p75_lag_contrib_rev p25_lag_contrib_rev;
** Formatting things to be easier to put into latex;
format dga %12.0fc;
format count %12.0fc;
format dga_avg %12.0fc;
format lag_gr_age %3.0fc;
rename lag_gr_highest_ecomp act_gr_highest_ecomp;
foreach x in high_ineq high_ineq2 lag_gr_prof_ind high_lag_gr_prof_alt 
high_lag_gr_mths_luna high_lag_gr_mths_liquid high_lag_gr_volat  
high_lag_gr_gift_dep high_lag_gr_ind_f high_lag_gr_f2contr 
high_lag_gr_mgn_fevent high_lag_gr_adm_eff high_lag_gr_mgmt_eff 
high_lag_bgov_max high_lag_bgov_tot high_lag_bgov14 high_lag_bgov56
high_lag_gr_uses_auditor high_lag_bgov5 
high_lag_gr_highest_ecomp high_lag_gr_100k_comp high_lag_gr_100k_contr
high_lag_gr_pct_fevents lag_gr_comm_np high_lag_gr_f2exp high_lag_gr_mjr90_frev high_lag_gr_mjr75_frev
high_lag_contrib_rev p90_lag_contrib_rev p75_lag_contrib_rev p25_lag_contrib_rev{;
	replace `x'=`x'*100;
	format `x' %9.1fc;
};
gen type="disrupt stand alone";
** Renaming those named "high" meaning they are above median to original var so can merge value-weighted later;
foreach x in ineq ineq2 lag_gr_prof_alt 
lag_gr_mths_luna lag_gr_mths_liquid lag_gr_volat  
lag_gr_gift_dep lag_gr_ind_f lag_gr_f2contr 
lag_gr_mgn_fevent lag_gr_adm_eff lag_gr_mgmt_eff 
lag_bgov_max lag_bgov_tot lag_bgov14 lag_bgov56
lag_gr_uses_auditor lag_bgov5 
lag_gr_highest_ecomp lag_gr_100k_comp lag_gr_100k_contr
lag_gr_pct_fevents lag_gr_f2exp 
lag_gr_mjr90_frev lag_gr_mjr75_frev lag_contrib_rev {;
	rename high_`x' `x';
};
save "avg grantee disrupt.dta", replace;
** Switching to value-weighted;
use "all grantee stats by daf.dta", clear;
gen count=1;
bys ein: gen uniq_count=1 if _n==1;
keep if style_disrupt==1;
save "disrupt stand alone grant vw.dta", replace;
collapse (sum) uniq_count count dga_count dga (mean) sd_dga dga_count_avg dga_avg lag_gr_age 
vw_dga_ineq vw_dga_ineq2 vw_dga_lag_gr_prof_alt 
vw_dga_lag_gr_mths_luna vw_dga_lag_gr_mths_liquid vw_dga_lag_gr_volat  
vw_dga_lag_gr_gift_dep vw_dga_lag_gr_ind_f vw_dga_lag_gr_f2contr 
vw_dga_lag_gr_mgn_fevent vw_dga_lag_gr_adm_eff vw_dga_lag_gr_mgmt_eff 
vw_dga_lag_bgov_max vw_dga_lag_bgov_tot vw_dga_lag_bgov14 vw_dga_lag_bgov56
vw_dga_lag_gr_uses_auditor vw_dga_lag_bgov5 
vw_dga_lag_gr_highest_ecomp vw_dga_lag_gr_100k_comp vw_dga_lag_gr_100k_contr
vw_dga_lag_gr_pct_fevents vw_dga_lag_gr_f2exp vw_dga_lag_gr_mjr90_frev vw_dga_lag_gr_mjr75_frev
vw_dga_lag_contrib_rev vw_dga_p90_lag_contrib_rev vw_dga_p75_lag_contrib_rev vw_dga_p25_lag_contrib_rev
vw_dga_lag_gr_comm_np vw_dga_lag_gr_prof_ind;
** Formatting things to be easier to put into latex;
format dga %12.0fc;
format count %12.0fc;
format dga_avg %12.0fc;
format lag_gr_age %3.0fc;
foreach x in ineq ineq2 lag_gr_prof_alt 
lag_gr_mths_luna lag_gr_mths_liquid lag_gr_volat  
lag_gr_gift_dep lag_gr_ind_f lag_gr_f2contr 
lag_gr_mgn_fevent lag_gr_adm_eff lag_gr_mgmt_eff 
lag_bgov_max lag_bgov_tot lag_bgov14 lag_bgov56
lag_gr_uses_auditor lag_bgov5 
lag_gr_highest_ecomp lag_gr_100k_comp lag_gr_100k_contr
lag_gr_pct_fevents lag_gr_f2exp lag_gr_mjr90_frev lag_gr_mjr75_frev
lag_contrib_rev p90_lag_contrib_rev p75_lag_contrib_rev p25_lag_contrib_rev
lag_gr_comm_np lag_gr_prof_ind{;
	replace vw_dga_`x'=vw_dga_`x'*100;
	format vw_dga_`x' %2.1fc;
	** Adding the rename in this loop as all are renamed unlike with non-vw;
	rename vw_dga_`x' `x';
};
gen type="disrupt value-weighted";
save "avg grantee disrupt value-weighted.dta", replace;

*******************************************************
** DE&I;
use "all grantee stats by daf.dta", clear;
gen count=1;
keep if focus_dei==1;
bys ein: gen uniq_count=1 if _n==1;
save "dei grant.dta", replace;
collapse (sum) uniq_count count dga_count dga (mean) sd_dga dga_count_avg dga_avg lag_gr_age 
high_ineq high_ineq2 lag_gr_prof_ind high_lag_gr_prof_alt 
high_lag_gr_mths_luna high_lag_gr_mths_liquid high_lag_gr_volat  
high_lag_gr_gift_dep high_lag_gr_ind_f high_lag_gr_f2contr 
high_lag_gr_mgn_fevent high_lag_gr_adm_eff high_lag_gr_mgmt_eff 
high_lag_bgov_max high_lag_bgov_tot high_lag_bgov14 high_lag_bgov56
high_lag_gr_uses_auditor high_lag_bgov5 lag_gr_highest_ecomp
high_lag_gr_highest_ecomp high_lag_gr_100k_comp high_lag_gr_100k_contr
high_lag_gr_pct_fevents lag_gr_comm_np high_lag_gr_f2exp high_lag_gr_mjr90_frev high_lag_gr_mjr75_frev 
high_lag_contrib_rev p90_lag_contrib_rev p75_lag_contrib_rev p25_lag_contrib_rev;
** Formatting things to be easier to put into latex;
format dga %12.0fc;
format count %12.0fc;
format dga_avg %12.0fc;
format lag_gr_age %3.0fc;
rename lag_gr_highest_ecomp act_gr_highest_ecomp;
foreach x in high_ineq high_ineq2 lag_gr_prof_ind high_lag_gr_prof_alt 
high_lag_gr_mths_luna high_lag_gr_mths_liquid high_lag_gr_volat  
high_lag_gr_gift_dep high_lag_gr_ind_f high_lag_gr_f2contr 
high_lag_gr_mgn_fevent high_lag_gr_adm_eff high_lag_gr_mgmt_eff 
high_lag_bgov_max high_lag_bgov_tot high_lag_bgov14 high_lag_bgov56
high_lag_gr_uses_auditor high_lag_bgov5 
high_lag_gr_highest_ecomp high_lag_gr_100k_comp high_lag_gr_100k_contr
high_lag_gr_pct_fevents lag_gr_comm_np high_lag_gr_f2exp high_lag_gr_mjr90_frev high_lag_gr_mjr75_frev
high_lag_contrib_rev p90_lag_contrib_rev p75_lag_contrib_rev p25_lag_contrib_rev{;
	replace `x'=`x'*100;
	format `x' %9.1fc;
};
gen type="de&i";
** Renaming those named "high" meaning they are above median to original var so can merge value-weighted later;
foreach x in ineq ineq2 lag_gr_prof_alt 
lag_gr_mths_luna lag_gr_mths_liquid lag_gr_volat  
lag_gr_gift_dep lag_gr_ind_f lag_gr_f2contr 
lag_gr_mgn_fevent lag_gr_adm_eff lag_gr_mgmt_eff 
lag_bgov_max lag_bgov_tot lag_bgov14 lag_bgov56
lag_gr_uses_auditor lag_bgov5 
lag_gr_highest_ecomp lag_gr_100k_comp lag_gr_100k_contr
lag_gr_pct_fevents lag_gr_f2exp 
lag_gr_mjr90_frev lag_gr_mjr75_frev lag_contrib_rev {;
	rename high_`x' `x';
};
save "avg grantee de&i.dta", replace;
** Switching to value-weighted;
use "all grantee stats by daf.dta", clear;
gen count=1;
keep if focus_dei==1;
bys ein: gen uniq_count=1 if _n==1;
save "dei grant vw.dta", replace;
collapse (sum) uniq_count count dga_count dga (mean) sd_dga dga_count_avg dga_avg lag_gr_age 
vw_dga_ineq vw_dga_ineq2 vw_dga_lag_gr_prof_alt 
vw_dga_lag_gr_mths_luna vw_dga_lag_gr_mths_liquid vw_dga_lag_gr_volat  
vw_dga_lag_gr_gift_dep vw_dga_lag_gr_ind_f vw_dga_lag_gr_f2contr 
vw_dga_lag_gr_mgn_fevent vw_dga_lag_gr_adm_eff vw_dga_lag_gr_mgmt_eff 
vw_dga_lag_bgov_max vw_dga_lag_bgov_tot vw_dga_lag_bgov14 vw_dga_lag_bgov56
vw_dga_lag_gr_uses_auditor vw_dga_lag_bgov5 
vw_dga_lag_gr_highest_ecomp vw_dga_lag_gr_100k_comp vw_dga_lag_gr_100k_contr
vw_dga_lag_gr_pct_fevents vw_dga_lag_gr_f2exp vw_dga_lag_gr_mjr90_frev vw_dga_lag_gr_mjr75_frev
vw_dga_lag_contrib_rev vw_dga_p90_lag_contrib_rev vw_dga_p75_lag_contrib_rev vw_dga_p25_lag_contrib_rev
vw_dga_lag_gr_comm_np vw_dga_lag_gr_prof_ind;
** Formatting things to be easier to put into latex;
format dga %12.0fc;
format count %12.0fc;
format dga_avg %12.0fc;
format lag_gr_age %3.0fc;
foreach x in ineq ineq2 lag_gr_prof_alt 
lag_gr_mths_luna lag_gr_mths_liquid lag_gr_volat  
lag_gr_gift_dep lag_gr_ind_f lag_gr_f2contr 
lag_gr_mgn_fevent lag_gr_adm_eff lag_gr_mgmt_eff 
lag_bgov_max lag_bgov_tot lag_bgov14 lag_bgov56
lag_gr_uses_auditor lag_bgov5 
lag_gr_highest_ecomp lag_gr_100k_comp lag_gr_100k_contr
lag_gr_pct_fevents lag_gr_f2exp lag_gr_mjr90_frev lag_gr_mjr75_frev
lag_contrib_rev p90_lag_contrib_rev p75_lag_contrib_rev p25_lag_contrib_rev
lag_gr_comm_np lag_gr_prof_ind{;
	replace vw_dga_`x'=vw_dga_`x'*100;
	format vw_dga_`x' %2.1fc;
	** Adding the rename in this loop as all are renamed unlike with non-vw;
	rename vw_dga_`x' `x';
};
gen type="de&i value-weighted";
save "avg grantee de&i value-weighted.dta", replace;

*******************************************************
** DND DAFS FEW;
use "all grantee stats by daf.dta", clear;
gen count=1;
bys ein: gen uniq_count=1 if _n==1;
keep if focus_dei!=1;
save "no dei grant.dta", replace;
collapse (sum) uniq_count count dga_count dga (mean) sd_dga dga_count_avg dga_avg lag_gr_age 
high_ineq high_ineq2 lag_gr_prof_ind high_lag_gr_prof_alt 
high_lag_gr_mths_luna high_lag_gr_mths_liquid high_lag_gr_volat  
high_lag_gr_gift_dep high_lag_gr_ind_f high_lag_gr_f2contr 
high_lag_gr_mgn_fevent high_lag_gr_adm_eff high_lag_gr_mgmt_eff 
high_lag_bgov_max high_lag_bgov_tot high_lag_bgov14 high_lag_bgov56
high_lag_gr_uses_auditor high_lag_bgov5 lag_gr_highest_ecomp
high_lag_gr_highest_ecomp high_lag_gr_100k_comp high_lag_gr_100k_contr
high_lag_gr_pct_fevents lag_gr_comm_np high_lag_gr_f2exp high_lag_gr_mjr90_frev high_lag_gr_mjr75_frev 
high_lag_contrib_rev p90_lag_contrib_rev p75_lag_contrib_rev p25_lag_contrib_rev;
** Formatting things to be easier to put into latex;
format dga %12.0fc;
format count %12.0fc;
format dga_avg %12.0fc;
format lag_gr_age %3.0fc;
rename lag_gr_highest_ecomp act_gr_highest_ecomp;
foreach x in high_ineq high_ineq2 lag_gr_prof_ind high_lag_gr_prof_alt 
high_lag_gr_mths_luna high_lag_gr_mths_liquid high_lag_gr_volat  
high_lag_gr_gift_dep high_lag_gr_ind_f high_lag_gr_f2contr 
high_lag_gr_mgn_fevent high_lag_gr_adm_eff high_lag_gr_mgmt_eff 
high_lag_bgov_max high_lag_bgov_tot high_lag_bgov14 high_lag_bgov56
high_lag_gr_uses_auditor high_lag_bgov5 
high_lag_gr_highest_ecomp high_lag_gr_100k_comp high_lag_gr_100k_contr
high_lag_gr_pct_fevents lag_gr_comm_np high_lag_gr_f2exp high_lag_gr_mjr90_frev high_lag_gr_mjr75_frev
high_lag_contrib_rev p90_lag_contrib_rev p75_lag_contrib_rev p25_lag_contrib_rev{;
	replace `x'=`x'*100;
	format `x' %9.1fc;
};
gen type="not de&i";
** Renaming those named "high" meaning they are above median to original var so can merge value-weighted later;
foreach x in ineq ineq2 lag_gr_prof_alt 
lag_gr_mths_luna lag_gr_mths_liquid lag_gr_volat  
lag_gr_gift_dep lag_gr_ind_f lag_gr_f2contr 
lag_gr_mgn_fevent lag_gr_adm_eff lag_gr_mgmt_eff 
lag_bgov_max lag_bgov_tot lag_bgov14 lag_bgov56
lag_gr_uses_auditor lag_bgov5 
lag_gr_highest_ecomp lag_gr_100k_comp lag_gr_100k_contr
lag_gr_pct_fevents lag_gr_f2exp 
lag_gr_mjr90_frev lag_gr_mjr75_frev lag_contrib_rev {;
	rename high_`x' `x';
};
save "avg grantee no de&i.dta", replace;
** Switching to value-weighted;
use "all grantee stats by daf.dta", clear;
gen count=1;
bys ein: gen uniq_count=1 if _n==1;
keep if focus_dei!=1;
save "no dei grant vw.dta", replace;
collapse (sum) uniq_count count dga_count dga (mean) sd_dga dga_count_avg dga_avg lag_gr_age 
vw_dga_ineq vw_dga_ineq2 vw_dga_lag_gr_prof_alt 
vw_dga_lag_gr_mths_luna vw_dga_lag_gr_mths_liquid vw_dga_lag_gr_volat  
vw_dga_lag_gr_gift_dep vw_dga_lag_gr_ind_f vw_dga_lag_gr_f2contr 
vw_dga_lag_gr_mgn_fevent vw_dga_lag_gr_adm_eff vw_dga_lag_gr_mgmt_eff 
vw_dga_lag_bgov_max vw_dga_lag_bgov_tot vw_dga_lag_bgov14 vw_dga_lag_bgov56
vw_dga_lag_gr_uses_auditor vw_dga_lag_bgov5 
vw_dga_lag_gr_highest_ecomp vw_dga_lag_gr_100k_comp vw_dga_lag_gr_100k_contr
vw_dga_lag_gr_pct_fevents vw_dga_lag_gr_f2exp vw_dga_lag_gr_mjr90_frev vw_dga_lag_gr_mjr75_frev
vw_dga_lag_contrib_rev vw_dga_p90_lag_contrib_rev vw_dga_p75_lag_contrib_rev vw_dga_p25_lag_contrib_rev
vw_dga_lag_gr_comm_np vw_dga_lag_gr_prof_ind;
** Formatting things to be easier to put into latex;
format dga %12.0fc;
format count %12.0fc;
format dga_avg %12.0fc;
format lag_gr_age %3.0fc;
foreach x in ineq ineq2 lag_gr_prof_alt 
lag_gr_mths_luna lag_gr_mths_liquid lag_gr_volat  
lag_gr_gift_dep lag_gr_ind_f lag_gr_f2contr 
lag_gr_mgn_fevent lag_gr_adm_eff lag_gr_mgmt_eff 
lag_bgov_max lag_bgov_tot lag_bgov14 lag_bgov56
lag_gr_uses_auditor lag_bgov5 
lag_gr_highest_ecomp lag_gr_100k_comp lag_gr_100k_contr
lag_gr_pct_fevents lag_gr_f2exp lag_gr_mjr90_frev lag_gr_mjr75_frev
lag_contrib_rev p90_lag_contrib_rev p75_lag_contrib_rev p25_lag_contrib_rev
lag_gr_comm_np lag_gr_prof_ind{;
	replace vw_dga_`x'=vw_dga_`x'*100;
	format vw_dga_`x' %2.1fc;
	** Adding the rename in this loop as all are renamed unlike with non-vw;
	rename vw_dga_`x' `x';
};
gen type="not de&i value-weighted";
save "avg grantee no de&i value-weighted.dta", replace;

** COMBINING BY DAF TYPE AND ORDERING FOR DAF GRANTEE SUMMARY TABLE;
use "avg grantee all value-weighted.dta", clear;
append using "avg grantee trad stand alone value-weighted.dta";
append using "avg grantee innov stand alone value-weighted.dta";
append using "avg grantee disrupt value-weighted.dta";
append using "avg grantee de&i value-weighted.dta";
append using "avg grantee no de&i value-weighted.dta";
order type dga_count dga_count_avg dga dga_avg count ineq ineq2 
lag_gr_prof_alt lag_gr_mths_liquid lag_gr_mths_luna lag_gr_volat lag_gr_comm_np
p75_lag_contrib_rev p90_lag_contrib_rev lag_gr_adm_eff lag_gr_uses_auditor
lag_bgov_tot lag_bgov14 lag_bgov56  lag_gr_gift_dep
lag_gr_f2contr lag_gr_f2exp lag_gr_mgn_fevent lag_gr_mjr75_frev lag_gr_mjr90_frev lag_gr_pct_fevents
count uniq_count;
keep type dga_count dga_count_avg dga dga_avg sd_dga ineq ineq2 
lag_gr_prof_alt lag_gr_mths_liquid lag_gr_mths_luna lag_gr_volat lag_gr_comm_np
p75_lag_contrib_rev p90_lag_contrib_rev lag_gr_adm_eff lag_gr_uses_auditor
lag_bgov_tot lag_bgov14 lag_bgov56  lag_gr_gift_dep
lag_gr_f2contr lag_gr_f2exp lag_gr_mgn_fevent lag_gr_mjr75_frev lag_gr_mjr90_frev lag_gr_pct_fevents;
save "grantee summary table value weighted.dta", replace;

** RUNNING THE TESTS TO SEE IF SIGNIFICANTLY DIFFERENT BY STYLE OR TYPE;
** Now getting significance for univariate tests;
use "trad stand alone grant vw.dta", clear;
append using "innov stand alone grant vw.dta";
append using "disrupt stand alone grant vw.dta";
gen type="trad" if style_trad==1;
replace type="innov" if style_innov==1;
replace type="disrupt" if style_disrupt==1;
tab type, m;
egen group=group(type);
reg vw_dga_ineq i.group, vce(robust);
testparm i.group, equal;
testparm i.group;
reg vw_dga_ineq2 i.group, vce(robust);
testparm i.group, equal;
testparm i.group;
** Economic stability;
reg vw_dga_lag_gr_prof_alt i.group, vce(robust);
testparm i.group, equal;
testparm i.group;
reg vw_dga_lag_gr_mths_liquid i.group, vce(robust);
testparm i.group, equal;
testparm i.group;
reg vw_dga_lag_gr_mths_luna i.group, vce(robust);
testparm i.group, equal;
testparm i.group;
reg vw_dga_lag_gr_volat i.group, vce(robust);
testparm i.group, equal;
testparm i.group;
reg vw_dga_lag_gr_comm_np i.group, vce(robust);
testparm i.group, equal;
testparm i.group;
reg vw_dga_p75_lag_contrib_rev i.group, vce(robust);
testparm i.group, equal;
testparm i.group;
reg vw_dga_p90_lag_contrib_rev i.group, vce(robust);
testparm i.group, equal;
testparm i.group;
** Governance;
reg vw_dga_lag_gr_adm_eff  i.group, vce(robust);
testparm i.group, equal;
testparm i.group;
reg vw_dga_lag_gr_uses_auditor i.group, vce(robust);
testparm i.group, equal;
testparm i.group;
reg vw_dga_lag_bgov_tot  i.group, vce(robust);
testparm i.group, equal;
testparm i.group;
reg vw_dga_lag_bgov14  i.group, vce(robust);
testparm i.group, equal;
testparm i.group;
reg vw_dga_lag_bgov56 i.group, vce(robust);
testparm i.group, equal;
testparm i.group;
** Fundraising;
reg vw_dga_lag_gr_gift_dep  i.group, vce(robust);
testparm i.group, equal;
testparm i.group;
reg vw_dga_lag_gr_f2contr   i.group, vce(robust);
testparm i.group, equal;
testparm i.group;
reg vw_dga_lag_gr_f2exp   i.group, vce(robust);
testparm i.group, equal;
testparm i.group;
reg vw_dga_lag_gr_mgn_fevent   i.group, vce(robust);
testparm i.group, equal;
testparm i.group;
reg vw_dga_lag_gr_mjr75_frev   i.group, vce(robust);
testparm i.group, equal;
testparm i.group;
reg vw_dga_lag_gr_mjr90_frev  i.group, vce(robust);
testparm i.group, equal;
testparm i.group;


** Now getting significance for univariate tests;
use "dei grant vw.dta", clear;
append using "no dei grant vw.dta";
rename focus_dei type;
ttest vw_dga_ineq, by(type);
ttest vw_dga_ineq2, by(type);

** Economic stability;
ttest vw_dga_lag_gr_prof_alt, by(type);
ttest vw_dga_lag_gr_mths_liquid, by(type);
ttest vw_dga_lag_gr_mths_luna, by(type);
ttest vw_dga_lag_gr_volat, by(type);
ttest vw_dga_lag_gr_comm_np, by(type);
ttest vw_dga_p75_lag_contrib_rev, by(type);
ttest vw_dga_p90_lag_contrib_rev, by(type);

** Governance;
ttest vw_dga_lag_gr_adm_eff, by(type);
ttest vw_dga_lag_gr_uses_auditor, by(type);
ttest vw_dga_lag_bgov_tot, by(type);
ttest vw_dga_lag_bgov14, by(type);
ttest vw_dga_lag_bgov56, by(type);

** Fundraising;
ttest vw_dga_lag_gr_gift_dep, by(type);
ttest vw_dga_lag_gr_f2contr, by(type);
ttest vw_dga_lag_gr_f2exp, by(type);
ttest vw_dga_lag_gr_mgn_fevent, by(type);
ttest vw_dga_lag_gr_mjr75_frev, by(type);
ttest vw_dga_lag_gr_mjr90_frev, by(type);

** REPEATING COMBINATION BUT FOR THE DAF TYPE WITH EQUAL-WEIGHTING THAT GOES IN APPENDIX;

use "avg grantee all.dta", clear;
append using "avg grantee trad stand alone.dta";
append using "avg grantee innov stand alone.dta";
append using "avg grantee disrupt.dta";
append using "avg grantee de&i.dta";
append using "avg grantee no de&i.dta";
order type dga_count dga_count_avg dga dga_avg sd_dga ineq ineq2 
lag_gr_prof_alt lag_gr_mths_liquid lag_gr_mths_luna lag_gr_volat lag_gr_comm_np
p75_lag_contrib_rev p90_lag_contrib_rev lag_gr_adm_eff lag_gr_uses_auditor
lag_bgov_tot lag_bgov14 lag_bgov56 act_gr_highest_ecomp lag_gr_gift_dep
lag_gr_f2contr lag_gr_f2exp lag_gr_mgn_fevent lag_gr_mjr75_frev lag_gr_mjr90_frev lag_gr_pct_fevents
count uniq_count;
keep type dga_count dga_count_avg dga dga_avg sd_dga ineq ineq2 
lag_gr_prof_alt lag_gr_mths_liquid lag_gr_mths_luna lag_gr_volat lag_gr_comm_np
p75_lag_contrib_rev p90_lag_contrib_rev lag_gr_adm_eff lag_gr_uses_auditor
lag_bgov_tot lag_bgov14 lag_bgov56 act_gr_highest_ecomp lag_gr_gift_dep
lag_gr_f2contr lag_gr_f2exp lag_gr_mgn_fevent lag_gr_mjr75_frev lag_gr_mjr90_frev lag_gr_pct_fevents
count uniq_count;
save "grantee summary table equal weighted.dta", replace;


** RUNNING THE TESTS TO SEE IF SIGNIFICANTLY DIFFERENT BY STYLE OR TYPE;
** Now getting significance for univariate tests;
use "trad stand alone grant.dta", clear;
append using "innov stand alone grant.dta";
append using "disrupt stand alone grant.dta";
gen type="trad" if style_trad==1;
replace type="innov" if style_innov==1;
replace type="disrupt" if style_disrupt==1;
tab type, m;
egen group=group(type);
reg dga_ineq i.group, vce(robust);
testparm i.group, equal;
testparm i.group;
reg dga_ineq2 i.group, vce(robust);
testparm i.group, equal;
testparm i.group;
** Economic stability;
reg dga_lag_gr_prof_alt i.group, vce(robust);
testparm i.group, equal;
testparm i.group;
reg dga_lag_gr_mths_liquid i.group, vce(robust);
testparm i.group, equal;
testparm i.group;
reg dga_lag_gr_mths_luna i.group, vce(robust);
testparm i.group, equal;
testparm i.group;
reg dga_lag_gr_volat i.group, vce(robust);
testparm i.group, equal;
testparm i.group;
reg dga_lag_gr_comm_np i.group, vce(robust);
testparm i.group, equal;
testparm i.group;
reg dga_p75_lag_contrib_rev i.group, vce(robust);
testparm i.group, equal;
testparm i.group;
reg dga_p90_lag_contrib_rev i.group, vce(robust);
testparm i.group, equal;
testparm i.group;
** Governance;
reg dga_lag_gr_adm_eff  i.group, vce(robust);
testparm i.group, equal;
testparm i.group;
reg dga_lag_gr_uses_auditor i.group, vce(robust);
testparm i.group, equal;
testparm i.group;
reg dga_lag_bgov_tot  i.group, vce(robust);
testparm i.group, equal;
testparm i.group;
reg dga_lag_bgov14  i.group, vce(robust);
testparm i.group, equal;
testparm i.group;
reg dga_lag_bgov56 i.group, vce(robust);
testparm i.group, equal;
testparm i.group;
** Fundraising;
reg dga_lag_gr_gift_dep  i.group, vce(robust);
testparm i.group, equal;
testparm i.group;
reg dga_lag_gr_f2contr   i.group, vce(robust);
testparm i.group, equal;
testparm i.group;
reg dga_lag_gr_f2exp   i.group, vce(robust);
testparm i.group, equal;
testparm i.group;
reg dga_lag_gr_mgn_fevent   i.group, vce(robust);
testparm i.group, equal;
testparm i.group;
reg dga_lag_gr_mjr75_frev   i.group, vce(robust);
testparm i.group, equal;
testparm i.group;
reg dga_lag_gr_mjr90_frev  i.group, vce(robust);
testparm i.group, equal;
testparm i.group;
reg lag_gr_highest_ecomp i.group, vce(robust);
testparm i.group, equal;
testparm i.group;

** Now getting significance for univariate tests;
use "dei grant.dta", clear;
append using "no dei grant.dta";
rename focus_dei type;
ttest dga_ineq, by(type);
ttest dga_ineq2, by(type);

** Economic stability (i.e., financial constraints);
ttest dga_lag_gr_prof_alt, by(type);
ttest dga_lag_gr_mths_liquid, by(type);
ttest dga_lag_gr_mths_luna, by(type);
ttest dga_lag_gr_volat, by(type);
ttest dga_lag_gr_comm_np, by(type);
ttest dga_p75_lag_contrib_rev, by(type);
ttest dga_p90_lag_contrib_rev, by(type);

** Governance;
ttest dga_lag_gr_adm_eff, by(type);
ttest dga_lag_gr_uses_auditor, by(type);
ttest dga_lag_bgov_tot, by(type);
ttest dga_lag_bgov14, by(type);
ttest dga_lag_bgov56, by(type);

** Fundraising;
ttest dga_lag_gr_gift_dep, by(type);
ttest dga_lag_gr_f2contr, by(type);
ttest dga_lag_gr_f2exp, by(type);
ttest dga_lag_gr_mgn_fevent, by(type);
ttest dga_lag_gr_mjr75_frev, by(type);
ttest dga_lag_gr_mjr90_frev, by(type);
ttest lag_gr_highest_ecomp, by(type);


log close;
